﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;

namespace AppRPG
{
    class Frame
    {
        private Size _size;
        private Point _beginPosition;
        private int _delta;

        public Frame(Size size, Point beginPosiiton, int delta)
        {
            _size = size;
            _beginPosition = beginPosiiton;
            _delta = delta;
        }

        public int ClickOnFrame(Point positionClick)
        {
            if (_beginPosition.X <= positionClick.X && _beginPosition.X + _size.Width >= positionClick.X)
                if ((_beginPosition.Y <= positionClick.Y && _beginPosition.Y + _size.Height >= positionClick.Y))
                    return positionClick.Y / _delta - _beginPosition.Y / _delta;
            return -1;
        }

        public void PaintFrame(Graphics device)
        {
            device.FillRectangle(Brushes.DimGray, _beginPosition.X, _beginPosition.Y, _size.Width, _size.Height);
        }

    }
}
